package com.sx.manage.controller.bank;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sx.manage.controller.base.MBaseController;
import com.sx.manage.service.bank.IMBasePayBankService;
import com.sx.model.manage.mybatis.form.bank.MPayBankForm;
import com.sx.model.manage.mybatis.vo.bank.MDropDownVO;
import com.sx.model.manage.mybatis.vo.result.ResultDropDownListVO;

/**
 * 总行
 * 
 * @author zwm
 *
 */
@Controller
@RequestMapping("/payBankInfo")
public class MPayBankInfoController extends MBaseController {

	private Logger log = LoggerFactory.getLogger(this.getClass());
	@Resource(name = "mBasePayBankServiceImpl")
	private IMBasePayBankService mBasePayBankServiceImpl;

	/**
	 * 
	 * 查询银行需要参数 总行 总行编码 城市编码
	 */
	@RequestMapping("/query_huaXia")
	@ResponseBody
	public ResultDropDownListVO<MDropDownVO> ajaxSerchHuaXia(MPayBankForm form) {
		log.info("查询总行信息下拉框form={}",form);
		if (StringUtils.isBlank(form.getChannel_type())) {
			MDropDownVO downVO = new MDropDownVO();
			downVO.setText("请选择开户渠道");
			List<MDropDownVO> list = new ArrayList<>();
			list.add(downVO);
			log.info("开户渠道为空form={}",form);
			return new ResultDropDownListVO<>(list, 1, 1, 1);
		}
		return mBasePayBankServiceImpl.queryBankInfoHuaXiaVO(form);
	}

}
